<!--
 * @Description: 
 * @Author: charles
 * @Date: 2021-05-05 22:02:56
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-01-08 10:07:41
-->
<template>
  <!--1. 容器 -->
  <div ref="left1_container" id="container" style="height: 95%"></div>
</template>
<script>
  //引入折线构造函数
  import {Line} from '@antv/g2plot'
  export default{
   data(){
      return{
         dataArr:[ { year: '7', value: 3 },
  { year: '8', value: 0 },
  { year: '9', value: 0 },
  { year: '10', value: 59 },
  { year: '11', value: 17 },
  { year: '12', value: 37 },
  { year: '13', value: 0 },
  { year: '14', value: 21 },
  { year: '15', value: 19 },]
       }
   },
   created(){

   },
   mounted(){
    this.initChart()   },
   methods:{
     //创建一个折线图实例对象
     initChart(){
      const line = new Line('container', {
            data:this.dataArr,
           xField: 'year',
           yField: 'value',
           });

      line.render();
     }
   }
  }
</script>
<style scoped>

</style>